﻿#include "EffectsShaderFactory.h"
#include "OriginalShader.h"
#include "GrayShader.h"
#include "ThresholdShader.h"
#include "PixelInversionShader.h"
#include "GammaShader.h"
#include "NostalgiaShader.h"
#include "BrightnessExposureContrastSaturationShader.h"
#include "CtrlLShader.h"

EffectsShaderFactory::EffectsShaderFactory()
{
}

BaseShader* EffectsShaderFactory::GetShader(OpenGLEffects effectsType)
{
	if (currentShader) {
		//currentShader->Release();
		delete currentShader;
		currentShader = nullptr;
	}
	switch (effectsType)
	{
	case OpenGLEffects::ORIGINAL:
		return currentShader = new OriginalShader();
	case OpenGLEffects::GRAY:
		return currentShader = new GrayShader();
	case OpenGLEffects::BLACK_AND_WHITE:
		return  currentShader = new ThresholdShader();
	case OpenGLEffects::PIXEL_INVERSION:
		return  currentShader = new PixelInversionShader();
	case OpenGLEffects::GAMMA:
		return  currentShader = new GammaShader();
	case OpenGLEffects::NOSTALGIA:
		return  currentShader = new NostalgiaShader();
	case OpenGLEffects::BRIGHTNESS_EXPOSURE_CONTRAST_STURATION:
		return  currentShader = new BrightnessExposureContrastSaturationShader();
	case OpenGLEffects::CTRL_L:
		return  currentShader = new CtrlLShader();
	default:
		return  currentShader = new OriginalShader();
	}
}
EffectsShaderFactory::~EffectsShaderFactory()
{
}
